package crudfx.control;
import crudfx.interop.*;
import crudfx.data.*;
import javax.swing.*;
import javax.swing.event.*;
/**
 * @profile desktop
 * @author Sergey Surikov
 */
public class VerticalSlider extends UIComponent{
    protected var jSlider:JSlider;
    public var minimum:Integer=0 on replace {jSlider.setMinimum(minimum);};
    public var maximum:Integer=100 on replace {jSlider.setMaximum(maximum);};
    public var value:Integer=50 on replace {jSlider.setValue(value);};
    init{
        jSlider=new JSlider(SwingConstants.VERTICAL);
        jSlider.setMinimum(minimum);
        jSlider.setMaximum(maximum);
        jSlider.setValue(value);
        var listener:ChangeListener=ChangeListener{
            override function stateChanged(e:ChangeEvent):Void{value=jSlider.getValue();}
            }
        jSlider.addChangeListener(listener);
        }
    override public function getJComponent():JComponent{
        return jSlider;
        }
    override public function highlight(s:String):Boolean{
        return false;
        }
    override public function gather():DataTree{
        var me:DataTree=DataTree{ name:"VerticalSlider" };
        me.node("value").asInteger(0).value=value;
        return me;
        }
    }
